<SCRIPT LANGUAGE="JavaScript">     
    
    function tampil() {
        $("#hint").fadeIn("fast");
    }
    function sembunyi() {
        $("#hint").fadeOut("fast");
    }    
    
    function validation()
    {
        
        var age1 = document.getElementById('ResumeAge1');
        var age2 = document.getElementById('ResumeAge2');
        
        if(document.getElementById('ResumeUsePersonal').value == 1)
        {
            if( isNaN(age1.value) || isNaN(age2.value) )
            {
                age1.focus();
                age1.style.backgroundColor='#FF9';
                age2.style.backgroundColor='#FF9';
                alert("Anda harus memasukkan usia awal dan usia akhir dengan nilai yang valid");
                age1.style.backgroundColor='#FFF';
                age2.style.backgroundColor='#FFF';
                return false;
            }
            else
            {
                if( age1.value > age2.value )
                {
                    age1.focus();
                    age1.style.backgroundColor='#FF9';
                    age2.style.backgroundColor='#FF9';
                    alert("Usia awal harus lebih kecil dari usia akhir");
                    age1.style.backgroundColor='#FFF';
                    age2.style.backgroundColor='#FFF';
                    return false;
                }       
            }
        }
    }
    
    function swap_skill(temp)
    {
        if(temp.value=='[ Show ]')
        {
            $("#skill").slideDown('fast');
            document.getElementById('ResumeUseSkill').value = '1';
            temp.value='[ Hide ]';
        }
        else
        {
            $("#skill").slideUp('fast');
            document.getElementById('ResumeUseSkill').value = '0';
            temp.value='[ Show ]';
        }
    }
    
    function swap_misc(temp)
    {
        if(temp.value=='[ Show ]')
        {
            $("#misc").slideDown('fast');
            document.getElementById('ResumeUseMisc').value = '1'; 
            temp.value='[ Hide ]';
        }
        else
        {
            $("#misc").slideUp('fast');
            document.getElementById('ResumeUseMisc').value = '0';
            temp.value='[ Show ]';
        }
    }   
    
    function swap_personal(temp)
    {
        if(temp.value=='[ Show ]')
        {
            $("#personal").slideDown('fast');
            document.getElementById('ResumeUsePersonal').value = '1';
            temp.value='[ Hide ]';
        }
        else
        {
            $("#personal").slideUp('fast');
            document.getElementById('ResumeUsePersonal').value = '0';
            temp.value='[ Show ]';
        }
    }     
</SCRIPT>     


<?php       
e($javascript->link('jquery.js')); 
echo "<div class='form'>";   
    echo "<h2> Specific Resume Search </h2>";
    echo "<hr color='#2A7EF7'>";
    echo "<div class='kotak2'>";
    echo $form->create('Resume',array('controller'=>'resumes','action'=>'search_result','onsubmit'=>'return validation();'));

        $opAndOr[0] = 'OR';
        $opAndOr[1] = 'AND';
        
        $opMisc[0] = "Don't Care";
        $opMisc[1] = "Yes";

        $opExp[0]='Semua';
        $opExp[1]='Masih sekolah';
        $opExp[2]='Baru Lulus';
        $opExp[3]='1 Tahun';
        $opExp[4]='2 Tahun';
        $opExp[5]='3 Tahun';
        $opExp[6]='Diatas 3 Tahun';
            
        $opGender[0] = 'Semua';
        $opGender[1] = 'Laki-Laki';
        $opGender[2] = 'Perempuan';
        
        $opMartial[0] = 'All';
        $opMartial[1] = 'Single Only';
        
        $opCity[0] = 'All';
        foreach($cities as $city)
        {
            $opCity[$city['cities']['id']] = $city['cities']['name'];
        }

        $opAcademic[0] = 'All';
        foreach($academics as $academic)
        {
            $opAcademic[$academic['academics']['id']] = $academic['academics']['name'];
        }        
            
        echo "<div class='input'><label> <font style='font-size:140%;color:#888'><u>Resume </u></font></label> &nbsp </div>";   
        //echo $form->input('title',array('size'=>'30'));
        echo "<div class='input'>";
        echo "<label class='left'>Title</label><input type='text' id='keyword' name='data[Resume][title]' size='30'> ";
        echo " <img src='../img/hint.gif' onmouseover='tampil();' onmouseout='sembunyi();'>";  
?>
        <div id='hint' style='left:470px;display:none'>
        <b>Resume Title Tips</b><br>&nbsp - Fill blank if you don't care <br>&nbsp - Resume title represent jobseeker's career goal or career objective.<br> &nbsp &nbsp It is recommended that you state what you want (and the quailification) to do.<br> &nbsp &nbsp Example : Web Developer experts in PHP & MySQL 
        </div>        
<?php
        echo "</div>";        
        
        echo $form->input('city',array('options'=>$opCity));
        echo $form->input('academic',array('options'=>$opAcademic));    
        echo $form->input('exp',array('label'=>'Working Experiencs','options'=>$opExp));
        
        echo "<div class='input'> <label> <font style='font-size:140%;color:#888'><u>Skill </u></font> </label><input type='button' style='border:solid #efefff' value='[ Show ]' class='sky' onClick='swap_skill(this);'></div>";         
        echo "<div id='skill' style='display:none'>";
            echo $form->input('use_skill',array('type'=>'hidden','value'=>0));
            //echo $form->input('skill',array('size'=>'30'));
            echo "<div class='input'>";
            echo "<label class='left'>Skill</label><input type='text' id='keyword' name='data[Resume][skill]' size='30'> ".$form->input('opskill',array('div'=>false,'label'=>false,'options'=>$opAndOr));;
            echo "<br><label class='left'>&nbsp</label> <span class='info'>( Seperate each entry with coma ',' )</span>";  
            echo "</div>";             
            
            //echo $form->input('opskill',array('label'=>'&nbsp','options'=>$opAndOr));
            
        echo "</div>";
        
        echo "<div class='input'> <label> <font style='font-size:140%;color:#888'><u>Personal Detail </u></font> </label><input type='button' style='border:solid #efefff' value='[ Show ]' class='sky' onClick='swap_personal(this);'></div>";
        echo "<div id='personal' style='display:none'>";
            echo $form->input('use_personal',array('type'=>'hidden','value'=>0));   
            echo $form->input('gender',array('options'=>$opGender));
            echo $form->input('martial_status',array('options'=>$opMartial));
            echo "<div class='input'><label> Age</label>";
            echo "<input type='text' name='data[Resume][age1]' id='ResumeAge1' value='17' size='3'> to <input type='text' name='data[Resume][age2]' id='ResumeAge2' value='50' size='3'>";
            echo "</div>";   
        echo "</div>";
        
        echo "<div class='input'> <label> <font style='font-size:140%;color:#888'><u>Miscelaonus </u></font> </label><input type='button' style='border:solid #efefff' value='[ Show ]' class='sky' onClick='swap_misc(this);'></div>";                            
        echo "<div id='misc' style='display:none'>"; 
            echo $form->input('use_misc',array('type'=>'hidden','value'=>0));
            echo $form->input('relocate',array('label'=>'Willing to relocate','options'=>$opMisc));
            echo $form->input('travel',array('label'=>'Willing to travel','options'=>$opMisc));
            echo $form->input('vehicle',array('label'=>'Own Vehicle','options'=>$opMisc));
        echo "</div>";
    
        echo "<div class='input'>";
            echo "<label> &nbsp  </label>";
            echo "<input type='submit' value='Search'>";
        echo "</div>";
    echo "</form>"; 
    echo "</div>";
    echo ":. Untuk menelusuri semua resume hanya mengirimkan formulir ini dengan nilai default";
echo "</div>";
?>


